package pers.jphoebe.quartz.entity.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * Created by 蒋时华 on 2017-8-1.
 */
@ApiModel(value = "ResponseData", description = "返回对象")
public class ResponseData<T> {

    @ApiModelProperty(value = "返回码",required = true)
    private Integer code;
    @ApiModelProperty(value = "返回信息",required = true)
    private String message;
    @ApiModelProperty(value = "返回值",required = false)
    private T data;
    private Integer level;
    private ErrorCode errorCode;

    public ResponseData(ErrorCode errorCode){
        this.setCodeAndMessage(errorCode);
    }
    public ResponseData(){}

    public void setCodeAndMessage(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
        this.errorCode = errorCode;
    }

    public ErrorCode errorCode() {
        return errorCode;
    }

    public void setErrorCode(ErrorCode errorCode) {
        this.errorCode = errorCode;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

//    public String getMsg() {
//        return message;
//    }
//
//    public void setMsg(String message) {
//        this.message = message;
//    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
